﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.IO;
using Unity.Errors.types;
using DbGenerator.Model.units.database;
using Unity.Test.Performance.timer;

namespace DbGenerator.Factory.events
{
    public class TFactoryArgs
    {
        #region ctors
        public TFactoryArgs()
        {
            _GenerationTurtle = new TTurtle();
            _ReadTurtle = new TTurtle();
            _EntityTypes = new List<Type>();
        }
        #endregion

        #region properties
        private TTurtle _ReadTurtle;
        public TTurtle ReadTurtle
        {
            get { return _ReadTurtle; }
        }

        private TTurtle _GenerationTurtle;
        public TTurtle GenerationTurtle
        {
            get { return _GenerationTurtle; }
            set { _GenerationTurtle = value; }
        }

        private string _AssemblyName;
        public string AssemblyName
        {
            get
            {
                return _AssemblyName;
                //SErrorManager.CustomError()
                //    .Assert(_Database != null
                //    , new TErrorInfo(GetType(), "get.ConcreteModuleName")
                //    , "_Database is null. You must set it first");
                //return String.Format("DbGenerator.Concrete.{0}", _Database.DatabaseName);
            }
            set { _AssemblyName = value; }
        }

        private string _EntityFolderPath;
        public string EntityFolderPath
        {
            get
            {
                return _EntityFolderPath;
            }
            set
            {
                SErrorManager.Errors("CheckFailed")
                    .Assert(Directory.Exists(value)
                    , new TErrorInfo(GetType(), "EntityFolderPath.set")
                    , "Directory.Exists(value)");
                _EntityFolderPath = value;
            }
        }

        private SqlConnection _MasterConnection;
        public SqlConnection MasterConnection
        {
            get { return _MasterConnection; }
            set { _MasterConnection = value; }
        }

        private TDatabase _Database;
        public TDatabase Database
        {
            get { return _Database; }
            set { _Database = value; }
        }

        private bool _DropDatabase;
        public bool DropDatabase
        {
            get { return _DropDatabase; }
            set { _DropDatabase = value; }
        }

        private object _Dispatch;
        public object Dispatch
        {
            get { return _Dispatch; }
            set { _Dispatch = value; }
        }

        private List<Type> _EntityTypes;
        public List<Type> EntityTypes
        {
            get { return _EntityTypes; }
            set { _EntityTypes = value; }
        }

        public string FullEntityPath
        {
            get { return _EntityFolderPath + "\\" + _AssemblyName + ".dll"; }
        }

        #endregion
    }
}
